﻿using System.Text;
using System;
using PermutationCipher.Models;

namespace PermutationCipher
{
    internal class Program
    {
        /// <summary>
        /// 置换密码
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //用户输入明文和密钥
            Console.Write($"请输入明文：");
            string plain = Console.ReadLine();
            Console.Write($"请输入密钥：");
            string keyone = Console.ReadLine();
            //加密
            MyEncode myencode = new MyEncode();
            myencode.PlainText = plain;
            myencode.Key = keyone;
            myencode.Encode();
            //输出密文
            Console.WriteLine($"你的密文：{myencode.CipherText}");
            //用户输入密文和密钥
            Console.Write($"请输入密文：");
            string cipher = Console.ReadLine();
            Console.Write($"请输入密钥：");
            string keytwo = Console.ReadLine();
            MyDecode mydecode = new MyDecode();
            mydecode.CipherText = cipher;
            mydecode.Key = keytwo;
            mydecode.Decode();
            //输出明文
            Console.WriteLine($"你的明文：{mydecode.PlainText}");
            Console.ReadKey();
        }
    }
}